import React from 'react';
import PopupWindow from './PopupWindow';
import * as TeacherInformationTableStyle from './TeacherInformationTable.less';

export default class TeacherInformationTable extends React.Component {
  static propTypes = {
    name: React.PropTypes.string,
  };
  state = {
		toggle: false
	};
  constructor(props) {
    super(props);
  }
  handleOpen = () => {
		this.setState({
			toggle: true
		});
		
	}
  handleScroll = (ev) => {
    ev.preventDefault();
  }
  handleClose = () => {
		this.setState({
			toggle: false
		});
  	}
  render() {
    let { teachersInformation, children } = this.props;
    let { toggle }=this.state;
    let { name, certificate, studentCount, regdate, gender, school, grade, subject, homework } = teachersInformation;
    return (
      <div  className={TeacherInformationTableStyle.teacherInformationTable}>
          <span className='checked' onClick={this.handleOpen}>查看</span>
          <div style={{display:toggle?'block':'none'}} className='overLay' onWheel={this.handleScroll}></div>
        	<PopupWindow title='电子化教学日志' visible={toggle} teachersInformation={teachersInformation} >
              <table onWheel={this.handleScroll}>
                <tbody>
                  <tr>
                      <td><b>教师姓名：</b></td>
                      <td><span>{name||'-'}</span></td>
                      <td><b>性别：</b></td>
                      <td><span>{gender.text||'-'}</span></td>
                  </tr>
                  <tr>
                      <td><b>是否认证：</b></td>
                      <td><span>{certificate==0?'否':'是'}</span></td>
                      <td><b>所在学校：</b></td>
                      <td><span>{school.text||'-'}</span></td>
                  </tr>
                  <tr>
                      <td><b>学科：</b></td>
                      <td><span>{subject.text||'-'}</span></td>
                      <td><b>年级：</b></td>
                      <td><span>{grade.text||'-'}</span></td>
                  </tr>
                  <tr>
                      <td><b>注册时间：</b></td>
                      <td><span>{regdate||'-'}</span></td>
                      <td><b>学生人数：</b></td>
                      <td><span>{studentCount}</span></td>
                  </tr>
                  <tr>
                      <td><b>布置作业次数：</b></td>
                      <td><span>{homework.bzs}</span></td>
                      <td><b>批改作业次数：</b></td>
                      <td><span>{homework.pgs}</span></td>
                  </tr>
                  <tr>
                      <td><b>近30天布置作业次数：</b></td>
                      <td><span>{homework.bzs_30d}</span></td>
                      <td><b>最近布置作业时间：</b></td>
                      <td><span>{homework.zjbzrq||'-'}</span></td>
                  </tr>
                  <tr>
                      <td><b>近30天批改作业次数：</b></td>
                      <td><span>{homework.pgs_30d}</span></td>
                      <td><b>最近批改作业时间：</b></td>
                      <td><span>{homework.zjpgrq||'-'}</span></td>
                  </tr>
                  <tr>
                      <td><b>作业提交率：</b></td>
                      <td><span>{homework.tjs_rate+'%'}</span></td>
                      <td><b>作业批改率：</b></td>
                      <td><span>{homework.pgs_rate+'%'}</span></td>
                  </tr>
                  </tbody>
              </table>
  			     <button onClick={this.handleClose}>关闭</button>
  		    </PopupWindow>
      </div>
    );
  }
}
